import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    // 支持省略扩展名和优先级
    extensions: ['.js', '.jsx', '.ts', '.tsx'],
  },
  server: {
    port: 5173, // 前端服务端口
    proxy: {
      // '/api': {
      //   target: 'http://localhost:3000', // 修改为实际的后端服务地址
      //   changeOrigin: true,
      // },
      '/projectlist': {
        target: 'http://localhost:3000',
        changeOrigin: true,
      },
      '/api': {
        target: 'http://localhost:3000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
      '/projectPhase': {
        target: 'http://localhost:3000',
        changeOrigin: true
      },
      '/yjl': {
        target: 'http://localhost:3000',
        changeOrigin: true
      },
      '/afterSalesDemand': {
       target: 'http://localhost:3000',
       changeOrigin: true,
     },
     
    }
  }
})
